/*
 * Copyright 2010 Biz-e (info@biz-e.nl)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.biz_e.acl.client;

import java.util.List;

import nl.biz_e.acl.shared.model.Authorization;
import nl.biz_e.acl.shared.model.Context;
import nl.biz_e.acl.shared.model.User;
import nl.biz_e.acl.shared.model.UserGroup;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Asynchrone counterpart for the {@link AuthorizationService} interface
 * 
 * @author Joost A. Bloemsma
 * 
 */
public interface AuthorizationServiceAsync {

    /**
     * @see AuthorizationService#isAuthorized(User, Context)
     * @param user
     * @param ctx
     * @param async
     */
    public void isAuthorized(User user, Context ctx,
            AsyncCallback<Boolean> async);

    /**
     * @see AuthorizationService#isAuthorized(UserGroup, Context)
     * @param group
     * @param ctx
     * @param async
     */
    public void isAuthorized(UserGroup group, Context ctx,
            AsyncCallback<Boolean> async);

    /**
     * @see AuthorizationService#getAuthorizedUsers(Context)
     * @param ctx
     * @param async
     */
    public void getAuthorizedUsers(Context ctx, AsyncCallback<List<User>> async);

    /**
     * @see AuthorizationService#getAuthorizedGroups(Context)
     * @param ctx
     * @param async
     */
    public void getAuthorizedGroups(Context ctx,
            AsyncCallback<List<UserGroup>> async);

    /**
     * @see AuthorizationService#setAuthorization(User, Context, boolean)
     * @param user
     * @param ctx
     * @param approved
     * @param async
     */
    public void setAuthorization(User user, Context ctx, boolean approved,
            AsyncCallback<Void> async);

    /**
     * @see AuthorizationService#setAuthorization(UserGroup, Context, boolean)
     * @param group
     * @param ctx
     * @param approved
     * @param async
     */
    public void setAuthorization(UserGroup group, Context ctx,
            boolean approved, AsyncCallback<Void> async);

    /**
     * @see AuthorizationService#getAuthorization(User, Context)
     * @param user
     * @param ctx
     * @param async
     */
    public void getAuthorization(User user, Context ctx,
            AsyncCallback<Authorization> async);

    /**
     * @see AuthorizationService#getAuthorization(UserGroup, Context)
     * @param group
     * @param ctx
     * @param async
     */
    public void getAuthorization(UserGroup group, Context ctx,
            AsyncCallback<Authorization> async);

    /**
     * @see AuthorizationService#getAuthorizations(User)
     * @param user
     * @param async
     */
    public void getAuthorizations(User user,
            AsyncCallback<List<Authorization>> async);

    /**
     * @see AuthorizationService#getAuthorizations(UserGroup)
     * @param group
     * @param async
     */
    public void getAuthorizations(UserGroup group,
            AsyncCallback<List<Authorization>> async);

    /**
     * @see AuthorizationService#getAuthorizations(Context)
     * @param ctx
     * @param async
     */
    public void getAuthorizations(Context ctx,
            AsyncCallback<List<Authorization>> async);

    /**
     * @see AuthorizationService#deleteAuthorization(Authorization)
     * @param authorization
     * @param async
     */
    public void deleteAuthorization(Authorization authorization,
            AsyncCallback<Void> async);

    /**
     * @see AuthorizationService#deleteAuthorization(User, Context)
     * @param user
     * @param ctx
     * @param async
     */
    public void deleteAuthorization(User user, Context ctx,
            AsyncCallback<Void> async);

    /**
     * @see AuthorizationService#deleteAuthorization(UserGroup, Context)
     * @param group
     * @param ctx
     * @param async
     */
    public void deleteAuthorization(UserGroup group, Context ctx,
            AsyncCallback<Void> async);
}
